package com.ss.android.article.base.feature.model;

import com.ss.android.article.base.feature.subscribe.model.EntryItem;
import com.ss.android.common.AbsApiThread;
import org.json.JSONObject;

public final class MediaInfo implements Comparable {
    public long id;
    public long userId;
    public String name;
    public String avatarUrl;
    public String description;
    public boolean userVerified;
    public String scheme;
    public final EntryItem entryItem;
    public long modifyTime;

    public MediaInfo(long arg2) {
        this.id = arg2;
        this.entryItem = EntryItem.obtain(arg2);
    }

    public static MediaInfo fromJO(JSONObject jsonObject) {
        MediaInfo v0 = null;
        if(jsonObject != null) {
            long v2 = jsonObject.optLong("media_id");
            if(v2 > 0) {
                v0 = new MediaInfo(v2);
                v0.userId = jsonObject.optLong("user_id");
                v0.avatarUrl = jsonObject.optString("avatar_url");
                v0.name = jsonObject.optString("name");
                v0.scheme = jsonObject.optString("open_url");
                v0.description = jsonObject.optString("description");
                v0.userVerified = jsonObject.optBoolean("user_verified");
                if((jsonObject.has("subcribed")) && v0.entryItem != null) {
                    v0.entryItem.setSubscribed(AbsApiThread.optBoolean(jsonObject, "subcribed", false));
                    v0.entryItem.mType = 1;
                    if(!android.support.design.a.isTextEmpty(v0.name)) {
                        v0.entryItem.mName = v0.name;
                    }

                    if(!android.support.design.a.isTextEmpty(v0.avatarUrl)) {
                        v0.entryItem.mIconUrl = v0.avatarUrl;
                    }

                    if(android.support.design.a.isTextEmpty(v0.description)) {
                        return v0;
                    }

                    v0.entryItem.mDescription = v0.description;
                }
            }
        }

        return v0;
    }

    public static String a() {
        return "";
    }

    public final int compareTo(Object arg5) {
        int v0;
        if(arg5 == null) {
        label_11:
            v0 = 1;
        }
        else if(this.modifyTime > ((MediaInfo)arg5).modifyTime) {
            v0 = -1;
        }
        else if(this.modifyTime == ((MediaInfo)arg5).modifyTime) {
            v0 = 0;
        }
        else {
            v0 = 1;
        }

        return v0;
    }

    public final boolean equals(Object arg7) {
        boolean v0 = true;
        if(this != (((MediaInfo)arg7))) {
            if(arg7 != null && this.getClass() == arg7.getClass()) {
                if(this.id != ((MediaInfo)arg7).id) {
                    v0 = false;
                }
                else {
                }

                return v0;
            }

            v0 = false;
        }

        return v0;
    }

    public final String toString() {
        return "id:" + this.id + ";name: " + this.name;
    }
}

